Read BigInt
👓💯 Read Unsigned/Signed Big/Little-Endian BigInt from Buffer
Install
npm install read-bigint
Usage
import {
readBigInt64BE,
readBigInt64LE,
readBigUInt64BE,
readBigUInt64LE,
} from "read-bigint";
const buffer = Buffer.from([
0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88,
]);
readBigInt64BE(buffer, 1);
readBigInt64LE(buffer, 1);
readBigUInt64BE(buffer, 1);
readBigUInt64LE(buffer, 1);
The purpose of this package is to be able to read native BigInt from native Buffer.
This is mostly useful when targeting Node 10 (LTS Dubnium), which supports BigInt, but does not have
native methods for reading BigInt from Buffer. On Node 12 or any later version of Node, you should use the
native Buffer methods
instead.
API
Each of the exported methods is a direct copy of the Native Buffer.readBigInt() methods.
License
MIT